# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libdv
pkgver=1.0.0
pkgrel=7
pkgdesc="Software decoder for DV format video"
url="https://libdv.sourceforge.net/"
arch="all"
options="!check"  # No test suite.
license="LGPL-2.0-or-later"
makedepends="libxv-dev sdl12-compat-dev autoconf automake libtool
	linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tools"
source="https://downloads.sourceforge.net/libdv/libdv-$pkgver.tar.gz
	libdv-0.104-no-exec-stack.patch
	libdv-1.0.0-dso-linking.patch
	libdv-1.0.0-pic.patch
	automake.patch
	"

prepare() {
	update_config_sub
	default_prepare
	rm -f missing
	libtoolize --force && aclocal && autoconf && automake --add-missing
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-pic
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

tools() {
	pkgdesc="Basic tools to manipulate Digital Video streams"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="
19887a6f452fa7da8924901ad841f5c4a434a3bde56c932ddb43717592aa744281e3a8ad220231e11d7e6bc3b0e704952a8324e5f85d4e088675edceeeca7dc8  libdv-1.0.0.tar.gz
b6477886fb07a15e7213fda0aa42364420aff32991b4a6b2fb24e4ac6064bcc83063bd091d6e00a58ac7faa7f142840ab5099b8f2365b1ca47646e02ac98b5fd  libdv-0.104-no-exec-stack.patch
de160c8cf9e0a7a3975958b42a4833a968a32448218800d975e84da71dcc2d7c55d0e08f01fd7b4c7a1d2e15487b401ec9f85436ebbed746b4749846665abfd6  libdv-1.0.0-dso-linking.patch
19397c8a5f5b0b3ec64909f1834715cf58baf3314c7a19e643c823e7b58177997d9ad56aa059a4da9d01a5c5084ddb6a861425ad9fb191b97b2ac1fff736513b  libdv-1.0.0-pic.patch
e219b4bf50f87cceb3a39d23b050945defa36cc343ad0ab87ce7491d4f21b7c2dee0c9e1e795bb332b8d94c5bfd59ac24f7cb74c77ac6f1aea4eea752bb002df  automake.patch
"
